<!--
 * @Description: 
 * @Author: charles
 * @Date: 2020-11-03 14:04:56
 * @LastEditors: charles
 * @LastEditTime: 2021-08-01 14:08:37
-->
<template>
  <div>
    <div class="articleDetail" >
      <!-- 标题 -->
      <div class="title">{{detail.name}}</div>
      <!-- 时间作者 -->
      <div class="time">{{detail.beginTime| fmtDate}}~{{detail.endTime | fmtDate}} | {{detail.region}}</div>
      <!-- 内容 -->
      <div class="wrapper" v-html="detail.details"></div>
      <!-- 报名按钮 -->
      <div class="btn"><el-button @click="applyHandeler(detail.id)" type="primary" plain>报名</el-button></div>
    </div>
  </div>
</template>
<script>
import {get} from '../utils/request'
export default {
  
  data(){
    return{
      // 获取到从某篇文章传回id
      id:this.$route.query.id,
      detail:''
    }
  },
  methods:{
    // 获取文章明细
    async getArticleDetail(){
      const data = {
      id:this.id
      }
      await get('/index/project/findById',data).then(res=>{
        this.detail = res.data
        // console.log(this.detail);
      })
    },
    applyHandeler(id){
      // alert(id)
      this.$router.push({
        path:'/apply',
        query:{
          id
        }
      })
    }
  },
  created(){
    this.getArticleDetail()
  }
}
</script>

<style scoped lang='scss'>
.articleDetail{
  width: 980px;
  margin: 0 auto;
  .title{
    font-size: 20px;
    font-weight: 700;
    color: #000;
    text-align: center;
    padding: 1em 0;
  }
  .time{
    text-align: center;
    padding: 1em 0;
  }
  .content{
    font-size: 16px;
    padding: 0 1em;
  }
  .btn{
    padding: 2em 0;
    width: 200px;
    margin: 0 auto;
  }
}
</style>